<?php
  include(dirname(__FILE__)."/../apility/apility.php");

    class Report
    {
        function get_campaign_xmlreport($name,
                                          $startDay,
                                          $endDay,
                                          $selectedColumns,
                                          $aggregationTypes,
                                          $campaigns,
                                          $campaignStatuses,
                                          $adGroups,
                                          $adGroupStatuses,
                                          $keywords,
                                          $keywordStatuses,
                                          $adWordsType,
                                          $keywordType,
                                          $isCrossClient,
                                          $clientEmails,
                                          $includeZeroImpression,
                                          $sleepTime,
                                          $validateFirst)
        {
//          $report = getCampaignXmlReport($name,
//                                      $startDay,
//                                      $endDay,
//                                      $selectedColumns,
//                                      $aggregationTypes,
//                                      $campaigns,
//                                      $campaignStatuses,
//                                      $adGroups,
//                                      $adGroupStatuses,
//                                      $keywords,
//                                      $keywordStatuses,
//                                      $adWordsType,
//                                      $keywordType,
//                                      $isCrossClient,
//                                      $clientEmails,
//                                      $includeZeroImpression,
//                                      $sleepTime,
//                                      $validateFirst);

           return $this->turn_array($report);
        }

        function turn_array($report)
        {
            $reportarray = array();
//            $xml = domxml_open_mem($report);
           $dir = dirname(__FILE__);
           $file = $dir."/onecampaign.xml";
           $xml = domxml_open_file($file);

            $rows = $xml->get_elements_by_tagname("row");
            foreach($rows as $row)
            {
                $campaign = array();
                $columns = $row->attributes();
                foreach($columns as $column)
                {
                    $campaign[$column->name()] = $column->value();
                }
                $reportarray[] = $campaign;
            }

            return $reportarray;
        }
    }
?>